package com.kkb.springmvc.adapter;

import com.kkb.springmvc.handler.HttpRequestHandler;
import com.kkb.springmvc.model.ModelAndView;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class HttpRequestHandlerAdapter implements HandlerAdapter {
    @Override
    public ModelAndView handleRequest(Object handler, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ((HttpRequestHandler)handler).handleRequest(request,response);
        return null;
    }

    @Override
    public boolean supports(Object handler) {
        return (handler instanceof HttpRequestHandler);
    }
}
